import org.junit.jupiter.api.*;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.*;

import java.util.stream.Stream;


//@TestMethodOrder(MethodOrderer.OrderAnnotation.class) //表示不需要按照junit默认的执行顺序
@TestMethodOrder(MethodOrderer.Random.class)//执行顺序随机
public class JunitTest03 {



    @Order(4)
    @ParameterizedTest
    @ValueSource(ints = {1,2,3})
    void Test01(int num){
        System.out.println(num);
//        Assertions.assertEquals(1,num);
//        Assertions.assertNotEquals(2,num);
        String str = "123";
//        Assertions.assertNull(str);//断言为null
        Assertions.assertNotNull(str);



    }

    @Order(3)
    @ParameterizedTest
    @CsvSource({"1,2,'' "})
    void Test02(String x,String y,String z){
        System.out.println(x);
        System.out.println(y);
        System.out.println(z);
        System.out.println("----------");
    }

    @Order(2)
    @ParameterizedTest
    @CsvFileSource(resources = "test.csv")
    void Test03(String name,String pwd){
        System.out.println(name+":"+pwd);
    }


    public static Stream<Arguments> Generator() {
        return Stream.of(Arguments.arguments(1,"张三"),
                Arguments.arguments(2,"李四"));
    }


    @Order(1)
    @ParameterizedTest
    @MethodSource("Generator")
    void Test04(int id,String name){
        System.out.println(id+":"+name);
    }



    @Test
    void Test05(){
//        if (1==1){
//            System.out.println("测试通过");
//        }else{
//            System.out.println("测试不通过");
//        }

//        Assertions.assertEquals(1,1);


    }




}



